<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .sec {
      width: 100vw;
      height: 100vh;
      display: none;
    }
  </style>
</head>

<body>
  <div>
    <div class="sec" style="background: skyblue;display: block;"></div>
    <div class="sec" style="background: red;"></div>
    <div class="sec" style="background: darkblue;"></div>
  </div>
  <script>
    var num = 0;//当前下标
    window.onmousewheel = function (e) {//onmousewheel 鼠标的滚轮事件
      var e = e || window.event;
      console.log(e)
      // e.wheelDelta   -120 向下    120 向上
      if (e.wheelDelta > 0) {
        console.log("向上滚动了")
        num--
        if (num <= 0) {
          num = 0;
        }
        secShow()
      }
      if (e.wheelDelta < 0) {
        console.log("向下滚动了")
        num++
        if (num >= 2) {
          num = 2;
        }
        secShow()
      }
    }
    var secs = document.querySelectorAll(".sec")
    function secShow() {
      //  所有的div隐藏 当前下标的div显示 
      for (var i = 0; i < secs.length; i++) {
        secs[i].style.display = "none"
      }
      secs[num].style.display = "block"
    }
  </script>
</body>

</html>